from Cube.utility.SerialNumberGen import SerialNumberGen
from QMemberListEntry import QMemberListEntry


class QMemberListMaker:
    def __init__(self):
        self.MemberIDGen = SerialNumberGen(start=1).Gen
        self.TeamIDGen = SerialNumberGen(start=1).Gen

        self.TeamID = None
        self.TeamName = None
        self.MemberList = []

    def AddTeam(self, name=""):
        self.TeamID = self.TeamIDGen()
        self.TeamName = name

    def AddMember(self, optionMemberType, memberName="", currentMemberType=None, ):
        memberID = self.MemberIDGen()
        if currentMemberType is None:
            currentMemberType = optionMemberType[0]
        newMember = QMemberListEntry(self.TeamID, self.TeamName,
                                     memberID, memberName,
                                     currentMemberType, optionMemberType
                                     )
        self.MemberList.append(newMember)

    def MemberListGet(self):
        ret = self.MemberList
        return self.MemberList
